function getByClass( oParent, iclass ){
	var arr = [];
	var aEles = oParent.getElementsByTagName('*');
	for( var i=0; i<aEles.length; i++ ){
		if( aEles[i].className == iclass ){
			arr.push(aEles[i])
		}
	}
	return arr;
}

//qq
function scrollBox(){ 
var LimitH = function() {
	var obj = $("#scrollQQ");
	var width = obj.width();	   
	var height = obj.height(); 
	var	cw = document.documentElement.clientWidth,ch = document.documentElement.clientHeight,est = document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop; 
	var docH = parseInt($("#wrapper").height());
	obj.css({right:"0",top:(parseInt((ch)/2)+est)+"px",marginTop: -((parseInt(height))/2)+"px",zIndex: "999"});
	if(parseInt(cw)<=1002){
		obj.css({"left":1002+"px"})
	}
	else if(parseInt(cw)>=1022+2*parseInt(width)){
		obj.css({"left":parseInt(cw)/2+511+"px"})
		}
	
	else{
		obj.css({"left":"auto"})
		}
	if(ch<=height){
		obj.css({"top":(est)+"px","margin-top":"0"});
		//alert("top");
		if(parseInt(obj.css("top"))+parseInt(height) >= docH){
			obj.css({"top":(docH-parseInt(height))+"px","margin-top":0});
			}
		}
}	
LimitH();
$(window).resize(function(){ LimitH();});
$(window).scroll(function(){ LimitH();});
}
// qq定位
scrollBox();

function AutoTaskScroll(obj,timer,outr,len){
	var LiL = $(obj).find("li");
	var LiH = LiL.height();
	var autoPlay =function(){
		if($(LiL).length <= len){	
		$(obj).find("ul:first").animate({queue: false});
			}
		else
		{
		$(obj).find("ul:first").animate({
			marginTop:"-" + LiH + "px"
		},outr,function(){
			
			$(this).css({marginTop:"0"}).find("li:first").appendTo(this);
		});
		}
	};
		t = setInterval(function(){autoPlay()},timer);
	}

AutoTaskScroll('.auto_scroll1',3000,800,3);


// function second_nav(){
// 	var aParent = document.getElementById('show_nav').getElementsByTagName('span');
// 	for( var i=0; i<aParent.length; i++ ){
// 		aParent[i].onmouseover = function(){
// 			this.getElementsByTagName('i')[0].style.display = 'block';
// 		}

// 		aParent[i].onmouseout = function(){
// 			this.getElementsByTagName('i')[0].style.display = 'none';
// 		}
// 	}
// }
// second_nav(); 

function center(){
	var aP = $('.list1 li p');
	for( var i=0; i<aP.length; i++ ){
		var oSpanW = aP[i].getElementsByTagName('span')[0].offsetWidth;
		var oAW = aP[i].getElementsByTagName('a')[0].offsetWidth;
		aP[i].style.marginLeft = (aP[i].offsetWidth - oSpanW - oAW)/2 + 'px';
	}
}
center();



